package com.general.seckill.orderservice;

import com.general.seckill.common.Result;
import com.general.seckill.orderservice.entity.UserOrder;
import org.springframework.core.annotation.Order;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @description: OrderController
 * @author: general
 * @version: 1.0
 * @create: 2022-04-30 16:02
 **/
@RestController
@RequestMapping("order")
public class OrderController {

    @Resource
    private OrderService orderService;

    @PostMapping("create")
    public Result<?> createOrder(@RequestBody SecKillEntity entity){
        return orderService.createOrder(entity);
    }

    @GetMapping("getList")
    public Result<List<UserOrder>> getOrderList(@RequestParam Long userId, @RequestParam Long productId){
        return Result.buildSuccessResult(orderService.selectList(userId, productId));
    }
}
